import { Button } from 'vant'
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'
import headss from '../../components/header/index.vue'
import BScroll from '@better-scroll/core'
export default {
  name:'wode',
  data:function(){
    return {
      head:false,
      sclae:1,
      dd:0,
      swiperOption: {
        direction: 'vertical',
        slidesPerView: 'auto',
        freeMode: true,
        scrollbar: {
          el: '.swiper-scrollbar'
        },
        mousewheel: true,
        on: {
          touchEnd: function(swiper,event){
            // 你的事件
            console.log('我到底了')
          }
        }
      },
      iconimg:[{
        img:require('../../assets/image/xing.png') ,
        name:'我的宠物'
      },{
        img:require('../../assets/image/ding.png'),
        name:'服务订单'
      },{
        img:require('../../assets/image/pin.png'),
        name:'我的评价'
      },{
        img:require('../../assets/image/shou.png'),
        name:'我的收藏'
      }],
      lists:[{
        img:'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406562468256092133.png',
        name:'我的发布'
      },{
        img:'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406562467059948340.png',
        name:'我的寄养'
      },{
        img:'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406562469396821396.png',
        name:'我的收藏'
      },
      {
        img:'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406562471971340838.png',
        name:'实名认证'
      },{
        img:'https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a8af0c1f655f0011bb51f4/61c94cba1158630011a4e26c/16406562470892709551.png',
        name:'账户设置'
      }]
    }
  },
  components: {
    [Button.name]: Button,
    headss,
    Swiper,
    SwiperSlide
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {  
      this.bs = new BScroll(this.$refs.scroll, {
        probeType:3,
        click: true,
        outOfBoundaryDampingFactor:0.2
      })
      this.bs.on('scrollStart', () => {
        console.log('scrollStart-')
      })
      this.bs.on('scroll', ({ y }) => {
        // console.log(y/100)
        if (y > 0){
          console.log(1 + y / 100 / 2,'哈哈')
          this.sclae = 1 + y / 100 / 2
        } else {
          this.dd = y
          this.$refs.headtop.back(y)
          // console.log(this.$refs.headtop)
        }
      })
      this.bs.on('scrollEnd', (pos) => {
        // console.log(pos)
        this.sclae = 1
      }) 
    },
    clickHandler (item) {
      window.alert(item)
    }
  }
}
